package juc;

import lombok.SneakyThrows;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class MyCallable implements Callable {
    @Override
    public Object call() throws Exception {
        System.out.println("myCallable");
        return 1;
    }

    @SneakyThrows
    public static void main(String[] args) {
        MyCallable  myCallable = new MyCallable();
        FutureTask<Integer> ft = new FutureTask<>(myCallable);
        new Thread(ft).start();
        System.out.println("子线程的返回值" + ft.get());
    }
}
